﻿using AutoMapper;
using QuanLyGiaoVuDAL.DTO;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace QuanLyGiaoVuUI.Models.GiangVienClient
{
    public class DangKyGioDayGiangVienClientViewModel
    {
        public System.Guid MaThongTinGiangDay { get; set; }

        public System.Guid GiangVienId { get; set; }

        [Required(ErrorMessage="Chưa chọn lớp")]
        public System.Guid MaLopMonHoc { get; set; }

        public int MaTietDau { get; set; }

        public int MaTietSau { get; set; }

        public short Thu { get; set; }

        public System.Guid MaHocKy { get; set; }

        public Int16 DoUuTien { get; set; }

        //optional
        public int? Ca { get; set; }

        public bool? Buoi { get; set; }

        public GiangVienDTO GiangVienDTO { get; set; }

        public LopMonHocDTO LopMonHocDTO { get; set; }

        public TietHocDTO TietDauDTO { get; set; }

        public TietHocDTO TietSauDTO { get; set; }

        public IEnumerable<LopMonHocDTO> DanhSachLopMonHoc { get; set; }

        public IEnumerable<DangKyGioDayDTO> DanhSachDangKyGioDay { get; set; }

        public IEnumerable<TietHocDTO> DanhSachTietHoc { get; set; }

        public IEnumerable<int> DanhSachCa { get; set; }

        public DangKyGioDayDTO ToDangKyGioDayDTO()
        {
            Mapper.CreateMap(typeof(DangKyGioDayGiangVienClientViewModel), typeof(DangKyGioDayDTO));
            DangKyGioDayDTO dangKyGioDayDTO = new DangKyGioDayDTO();
            Mapper.Map(this, dangKyGioDayDTO);
            return dangKyGioDayDTO;
        }

        public DangKyGioDayGiangVienClientViewModel FromDangKyGioDayDTO(DangKyGioDayDTO dangKyGioDayDTO)
        {
            Mapper.CreateMap(typeof(GiangVienDTO), typeof(DangKyGioDayGiangVienClientViewModel));
            DangKyGioDayGiangVienClientViewModel model = new DangKyGioDayGiangVienClientViewModel();
            Mapper.Map(dangKyGioDayDTO, model);
            return model;
        }
    }
}